<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // console.log(a);//报错
        console.log(b);//undefined
        let a = 1;
        var b = 2;
        // console.log(c);//报错
        const c = 3;
        b++;
        console.log(b);//3
        a++;
        console.log(a);//2
      /*   c = c+a;
        console.log(c);//报错 */
        const obj = {
            name:'tom',
            age:10
        };
        obj.age = 20;
        var obj1 = {
            name:'xiaowangzi'
        }
        obj = obj1;
        console.log(obj);//报错

        /* 
        什么时候用let  什么时候用const?  用来有什么意义
        绝大部分变量使用let定义，只有确定不变化时才用const定义，95% let  
        绝大部分变量使用const定义，只有确定发生变化的量用let定义  95% const 语义稍微好些 
        
        */

    </script>
</body>
</html>